'use strict';
const Controller = require('egg').Controller;
class GController extends Controller {
  async create() {
    const { ctx } = this;
    ctx.validate({
      name: 'string',
      description: 'string',
      attributes: 'array',
    });
    try {
      const data = await ctx.helper.generator(ctx.request.body);
      ctx.success({ data });
    } catch (error) {
      console.error(error);
      ctx.error({ detail: error });
    }
  }
}
module.exports = GController;
